package com.zplus.managers.petservices.services;

import com.zplus.managers.petservices.entities.User;

import java.util.List;

public interface UserService
{
    /**
     * register a new user
     * @param user new user object
     * @return ture - if success, false otherwise
     */
    boolean register(User user);

    /**
     * delete given user, only check id
     * @param user the user to be deleted
     * @return true - del success, false otherwise
     */
    boolean delUser(User user);
    /**
     * query all users
     * @return a list contains all users
     */
    List<User> queryAllUser();

    /**
     * query a specific user with id
     * @param id user id
     * @return specific user object if success, null otherwise
     */
    User queryUserById(int id);

    /**
     * query user by user nickname
     *
     * @param name target name
     * @return specific user object if success, null otherwise
     */
    List<User> queryUserByName(String name);

    /**
     * update user info
     * @param userAft updated user object
     * @return true if success, false otherwise
     */
    boolean updateUserInfo(User userAft);

    /**
     * check the password matches, requires:
     * phoneNum, secret
     * @param user target account
     * @return true if passwd matches, false otherwise.
     */
    User checkLogin(User user);
}
